#include "Unit.h"
#include <iostream>

Unit::Unit(unsigned int amountByBaseUnit, char* unitName):m_amount(amountByBaseUnit),m_unitName(unitName){}

unsigned int Unit::toAmountOfBaseUnit(const unsigned int amount) const
{
	return(amount*m_amount);
}

void Unit::printAmountPerUnit(std::ostream& out, unsigned int& amount) const
{
	if(amount>=m_amount) {
		out<<amount/m_amount<<' '<<m_unitName<<' ';
	}
	amount=amount%m_amount;
}
